﻿using System;
using Lidgren.Network;

namespace NetBrick.Client
{
    public interface IClient
    {
        /// <summary>
        ///     Connect to the server.
        /// </summary>
        void Connect(string address, int port);

        /// <summary>
        ///     Disconnect from the server.
        /// </summary>
        void Disconnect();

        /// <summary>
        ///     Disconnect from the server.
        /// </summary>
        /// <param name="reason">The reason for disconnecting.</param>
        void Disconnect(string reason);

        /// <summary>
        ///     Add a packet handler.
        /// </summary>
        /// <param name="packetCode">The code of the handler's packet.</param>
        /// <param name="packetHandler">The packet handler to add.</param>
        void AddPacketHandler(ushort packetCode, PacketHandler packetHandler);

        /// <summary>
        ///     Send a packet to the server.
        /// </summary>
        /// <param name="packetCode">The packet code.</param>
        /// <param name="packetData">The packet to send.</param>
        /// <param name="deliveryMethod">The method of delivery.</param>
        void SendPacket(ushort packetCode, Object packetData, NetDeliveryMethod deliveryMethod);

        /// <summary>
        ///     Establish encryption with the server.
        /// </summary>
        void EstablishEncryption();
    }
}